﻿using System.Data.Entity.ModelConfiguration;
using TavDom.Library.Entities.Concrete;

namespace TavDom.Library.Entities.Mappings.EntityFramework
{
    public class UserMap : EntityTypeConfiguration<User>
    {
        public UserMap()
        {
            HasRequired(e => e.CreatedBy).WithMany(u => u.UserCreated).Map(m => m.MapKey("CreatedBy"));
            HasRequired(e => e.UpdatedBy).WithMany(u => u.UserUpdated).Map(m => m.MapKey("UpdatedBy"));

            //HasMany(u => u.UserRoles).WithMany(u => u.RoleUsers).Map(cs =>
            //{
            //    cs.MapLeftKey("UserId");
            //    cs.MapRightKey("RoleId");
            //    cs.ToTable("UsersRoles");
            //});
        }
    }
}
